package com.ruoyi.busi.guide.controller;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.web.core.BaseController;
import com.ruoyi.common.core.core.domain.R;
import com.ruoyi.busi.guide.domain.Task;
import com.ruoyi.busi.guide.service.ITaskService;

/**
 * 导师任务Controller
 */
@RestController
@RequestMapping("/busi/guide/task")
public class TaskController extends BaseController {
    @Autowired
    private ITaskService taskService;

    /**
     * 根据导师ID获取任务列表
     */
    @GetMapping("/mentor/{mentorId}")
    public R listByMentorId(@PathVariable Long mentorId) {
        return R.ok(taskService.selectByMentorId(mentorId));
    }

    /**
     * 根据状态获取任务列表
     */
    @GetMapping("/status/{status}")
    public R listByStatus(@PathVariable String status) {
        return R.ok(taskService.selectByStatus(status));
    }

    /**
     * 新增任务
     */
    @PostMapping
    public R add(@RequestBody Task task) {
        return R.ok(taskService.save(task));
    }

    /**
     * 修改任务
     */
    @PutMapping
    public R edit(@RequestBody Task task) {
        return R.ok(taskService.updateById(task));
    }

    /**
     * 删除任务
     */
    @DeleteMapping("/{taskIds}")
    public R remove(@PathVariable List<Long> taskIds) {
        return R.ok(taskService.deleteTaskByIds(taskIds));
    }
}
